function ModelLoader() 
{
	this.totalObjects = 0;
	this.loadedObjects = 0;
	this.onProggress = null;
	
	this.objects = [];

	this.objectLoaded = function() {
		this.loadedObjects++;
		if(this.onProggress!=null) {
			this.onProggress(this.loadedObjects,this.totalObjects);
		}
	}
	
	this.load = function(params) 
	{
		var worker = new Worker('js/core/LoaderWorker.js');
		var modelLoader = this;
		modelLoader.totalObjects++;
	
		var loader = new THREE.ColladaLoader();
		loader.options.convertUpAxis = true;
		self.callback = function colladaReady( collada )
		{
			if(	params.scale != undefined)
			{
				collada.scene.scale.x = params.scale;
				collada.scene.scale.y = params.scale;
				collada.scene.scale.z = params.scale;
				collada.scene.updateMatrix();
			}
			//changeMaterial(collada.scene);
			
			modelLoader.objects.push({ scene:collada.scene,name:params.name});
			modelLoader.objectLoaded();
		}
		loader.load( params.model, callback );
	}
	
	this.loadJS = function(params) 
	{
		var modelLoader = this;
		modelLoader.totalObjects++;
		
		var loader = new THREE.JSONLoader();
		var callback = function onComplete( geometry )
		{
			
			var mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial());
			
			if(	params.scale != undefined)
			{
				mesh.scale.x = params.scale;
				mesh.scale.y = params.scale;
				mesh.scale.z = params.scale;
			}
			
			geometry.mergeVertices();
			geometry.computeCentroids();
			geometry.computeFaceNormals();
			geometry.computeVertexNormals();
			geometry.computeTangents();
			geometry.computeBoundingBox();
			geometry.computeBoundingSphere();
			mesh.updateMatrix();
			
			changeMaterial(mesh);
			
			modelLoader.objects.push({scene:mesh,name:params.name});
			modelLoader.objectLoaded();
		}
		loader.load( params.model, callback );
	}
	
	this.helpGeometry = function(obj) {
		if(obj instanceof THREE.Geometry){
			geometry.mergeVertices();
			geometry.computeCentroids();
			geometry.computeFaceNormals();
			geometry.computeVertexNormals();
			geometry.computeTangents();
			geometry.computeBoundingBox();
			geometry.computeBoundingSphere();
		} else if( obj instanceof THREE.Object3D ){
			for(var i=0; i < o.children.length; i++){
				this.helpGeometry(o.children[i]);
			}
		} else if( obj instanceof THREE.Mesh ){
			this.helpGeometry(o.geometry);
		}
	}
	
	this.get = function(name) {
		for(var i=0; i<this.objects.length; i++) {
			if(this.objects[i].name == name) {
				var o = THREE.SceneUtils.cloneObject(this.objects[i].scene);
				changeMaterial(o);
				return o;
			}
		}
		return null;
	}
}